﻿//Template服务
function TemplateMapService(layerInfo) {
    var TemplateMapServer = new Object;
    TemplateMapServer.id = layerInfo.hasOwnProperty("GUID") ? layerInfo.GUID : "";
    TemplateMapServer.url = layerInfo.hasOwnProperty("URL") ? layerInfo.URL : "";
    TemplateMapServer.name = layerInfo.hasOwnProperty("NAME") ? layerInfo.NAME : "";
    TemplateMapServer.servertype = layerInfo.hasOwnProperty("SERVERTYPE") ? layerInfo.SERVERTYPE : "";
    TemplateMapServer.showLayer = (layerInfo.hasOwnProperty("PARAMETERS") && layerInfo.PARAMETERS != "") ? layerInfo.PARAMETERS : layerInfo.ID;
    TemplateMapServer.maximumLevel = layerInfo.hasOwnProperty("maximumLevel") ? layerInfo.maximumLevel : undefined;
    TemplateMapServer.minimumLevel = layerInfo.hasOwnProperty("maximumLevel") ? layerInfo.minimumLevel : 0;
    TemplateMapServer.CreateLayer = function () {
        var id = this.id;
        var url = this.url;
        var name = this.name;
        var servertype = this.servertype;
        var proxyUrl = "";
        var layers = viewer.imageryLayers;
        layerindex = layers._layers.length;
        var thisLayer = layers.addImageryProvider(new Cesium.UrlTemplateImageryProvider({
            url: url, //服务地址
            maximumLevel: this.maximumLevel,
            minimumLevel: this.minimumLevel
        }), layerindex);
        checkLayerTransparent(thisLayer, id);
        return thisLayer;
    }
    return TemplateMapServer;
}